<script setup>
import { getChannelListService } from '@/api/article.js'
import { ref } from 'vue'

const channelList = ref([])

const getChannelList = async () => {
  const res = await getChannelListService()
  channelList.value = res.data.data
}

getChannelList()

defineProps({
  modelValue: {
    type: [String, Number]
  },
  width: String
})

const emit = defineEmits(['update:modelValue'])
</script>

<template>
  <el-select
    :modelValue="modelValue"
    @update:modelValue="emit('update:modelValue', $event)"
    :style="{ width }"
  >
    <el-option
      v-for="elem in channelList"
      :key="elem.id"
      :label="elem.cate_name"
      :value="elem.id"
    ></el-option>
  </el-select>
</template>

<style scoped></style>
